package com.anda.logistics.map.util;


import org.apache.http.HttpEntity;

public class HTMLUtil {
	
	public static String getCharset(HttpEntity entity) {
		String charset = null;
		try {
			if (entity != null) {
				//System.out.println(entity.getContentType().getValue());
				charset = entity.getContentType().getValue().split(";")[1].split("=")[1];
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return  charset;
	}
	
	public static String getContent(HttpEntity entity) {
		String content = null;
		try {
			if (entity != null) {
				content = StreamUtil.getString(entity.getContent(), getCharset(entity));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return  content;
	}
}
